import sim.engine.SimState;
import sim.engine.Steppable;
import sim.util.Bag;


public class JailTermReducer implements Steppable {
	private static final long serialVersionUID = 1L;

	public void step(SimState state) {
		Rebellion reb = (Rebellion)state;
		
		Bag agents = reb.grid.allObjects;
		
		Agent agent;
		for(int i = 0; i < agents.size(); i++){
			agent = (Agent)agents.get(i);
			if(agent instanceof Civilian && agent.jailTerm > 0){
				agent.jailTerm--;
				if(agent.jailTerm == 0){
					reb.jailCount--;
					reb.quietCount++;
				}
			}
		}
	}

}
